package com.goldcn.user.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.goldcn.common.consts.RestConst;
import com.goldcn.common.exception.ServiceException;
import com.goldcn.common.model.DataResult;
import com.goldcn.common.util.CommonUtils;
import com.goldcn.common.util.IdGen;
import com.goldcn.config.ProConstants;
import com.goldcn.enums.ErpInterfaceCfgEnum;
import com.goldcn.enums.SmsTempEnum;
import com.goldcn.interceptor.SystemContext;
import com.goldcn.user.dao.*;
import com.goldcn.user.dto.*;
import com.goldcn.user.model.*;
import com.goldcn.user.vo.CompanyInfoVo;
import com.goldcn.util.Base64Utils;
import com.goldcn.util.CommonTools;
import com.goldcn.util.HttpUtil;
import com.goldcn.util.QRCodeUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;

import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by 1111 on 2016/11/14.
 */
@Service
@Transactional
public class CompanyInfoService {


    @Autowired
    CompanyInfoMapper companyInfoMapper;

    @Autowired
    UserInfoService userInfoService;

    @Autowired
    OrganizationalService organizationalService;

    @Autowired
    CompanyImgauthMapper companyImgauthMapper;

    @Autowired
    CompanyBankaccountMapper companyBankaccountMapper;

    @Autowired
    ErpInterfaceService erpInterfaceService;

    @Autowired
    UserInfoMapper userInfoMapper;

    @Autowired
    RestTemplate restTemplate;

    private Logger logger = Logger.getLogger(CompanyInfo.class);

    @Autowired
    ErrErpBaseMapper errErpBaseMapper;

    @Autowired
    ConfigService configService;

    @Autowired
    GoldSetingMapper goldSetingMapper;

    @Autowired
    CompanyDecorationPageMapper companyDecorationPageMapper;

    @Autowired
    CompanyDecorationService companyDecorationService;


    @Autowired
    OrganizationalMapper organizationalMapper;

    @Autowired
    HotWordMapper hotWordMapper;

    @Autowired
    HomepageMapper homepageMapper;

    @Autowired
    LogisticsMapper logisticsMapper;

    @Autowired
    SubjectMapper subjectMapper;


    //保存注册信息
    public Object registerCompanyInfo(SupplierRegisterDto registerDto) throws Exception {
        CompanyInfo company = companyInfoMapper.selectBycompanyName(registerDto.getCompanyInfo().getCompanyName(), SystemContext.getCompanyID());
        if (company != null) {
            throw new ServiceException("该公司已经注册", RestConst.ErrorCode.FORM_FAIL);
        }
        CompanyInfo companyInfo = new CompanyInfo();
        BeanUtils.copyProperties(companyInfo, registerDto.getCompanyInfo());
        Long timestamp = CommonUtils.getCurTimestamp();
        companyInfo.setCompanyInfoID(IdGen.get().nextId());
        companyInfo.setAddTime(timestamp);
        companyInfo.setUpdateTime(timestamp);
        companyInfo.setAccount(registerDto.getLoginName());
        companyInfo.setType(1);

        UserInfo userInfo = new UserInfo();
        userInfo.setAccount(registerDto.getLoginName());
        userInfo.setName(companyInfo.getCompanyName());
        userInfo.setPassWord(registerDto.getPassWord());
        userInfo.setMobile(companyInfo.getContactPhone());
        userInfo.setOrganizationalID(organizationalService.selectHeadCCB(SystemContext.getCompanyID()).getoID());
        userInfo.setType(5);
        userInfo.setUserID(IdGen.get().nextId());//为什么一开始没加id? 以前的数据没有id
        try {
            userInfoService.addUserInfo(userInfo);
        } catch (Exception e) {
            System.out.print(e);
        }
        Long userID = userInfoService.selectByAccount(registerDto.getLoginName(), SystemContext.getCompanyID()).getUserID();  //生成用户信息

        companyInfo.setUserID(userID);

        //批量插入图片
        JSONArray imgArray = JSONArray.fromObject(registerDto.getImgList());
        List<CompanyImgauth> imgList = (List) JSONArray.toCollection(imgArray, CompanyImgauth.class);
        batchInsertImg(companyInfo.getUserID(), companyInfo.getCompanyInfoID(), imgList);
        companyInfo.setCompanyID(SystemContext.getCompanyID());
        companyInfoMapper.insertSelective(companyInfo);


        //初始化金价
        GoldSeting AU9999 = new GoldSeting();
        AU9999.setCompanyID(SystemContext.getCompanyID());
        AU9999.setID(IdGen.get().nextId());
        AU9999.setNecklace("AU9999");
        AU9999.setSupplierID(companyInfo.getCompanyInfoID());

        goldSetingMapper.insertSelective(AU9999);

        GoldSeting AG999 = new GoldSeting();
        AG999.setCompanyID(SystemContext.getCompanyID());
        AG999.setID(IdGen.get().nextId());
        AG999.setNecklace("AG999");
        AG999.setSupplierID(companyInfo.getCompanyInfoID());

        goldSetingMapper.insertSelective(AG999);

        if (companyInfo.getType() == 2) {
            //增加对应店铺信息
            companyDecorationService.insert(companyInfo);
        }


        if (!configService.isOpenErp()) {
            return companyInfo.getCompanyInfoID();
        }
        try {
            int i = (int) erpInterfaceService.addOrUpdateCompanyForErp(companyInfo, 0);
            if (i != 1) {
                logger.info("抛转供应商信息失败:" + companyInfo.getCompanyInfoID() + ":" + companyInfo.getCompanyName());
            } else {
                logger.info("抛转供应商信息成功:" + companyInfo.getCompanyInfoID() + ":" + companyInfo.getCompanyName());
            }
        } catch (Exception e) {
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("mobile", CommonTools.getExtString(restTemplate, ErpInterfaceCfgEnum.TELEPHONE.getCode())); //下单人手机
            jsonObject.put("type", SmsTempEnum.ERP_EXCEPTION.getCode());
            jsonObject.put("param", new String[]{"对接ERP供应商信息失败:供应商ID为" + companyInfo.getCompanyInfoID()});
            DataResult resultSms = HttpUtil.httpPost(ProConstants.SMS + "/notice", jsonObject, restTemplate);
            if (resultSms.getIsSuccess() != 1) {
                logger.info("发送短信失败");
            }
            ErrErpBase errErpBase = new ErrErpBase();
            errErpBase.setErrorId(IdGen.get().nextId());
            errErpBase.setInfoId(companyInfo.getCompanyInfoID());
            errErpBase.setAddTime(System.currentTimeMillis());
            errErpBase.setType("0");
            errErpBaseMapper.insertSelective(errErpBase);
            logger.info("供应商对接ERP异常" + companyInfo.getCompanyInfoID());
        }
        return companyInfo.getCompanyInfoID();
    }


    //保存注册信息
    public Object registerShopInfo(SupplierRegisterDto registerDto) throws Exception {
        CompanyInfo company = companyInfoMapper.selectBycompanyName(registerDto.getCompanyInfo().getCompanyName(), SystemContext.getCompanyID());
        if (company != null) {
            throw new ServiceException("该商城或店铺已经注册", RestConst.ErrorCode.FORM_FAIL);
        }
        CompanyInfo companyInfo = new CompanyInfo();
        BeanUtils.copyProperties(companyInfo, registerDto.getCompanyInfo());
        Long timestamp = CommonUtils.getCurTimestamp();
        companyInfo.setCompanyInfoID(IdGen.get().nextId());
        companyInfo.setAddTime(timestamp);
        companyInfo.setUpdateTime(timestamp);
        companyInfo.setAccount(registerDto.getLoginName());
        companyInfo.setCompanyID(SystemContext.getCompanyID());
        companyInfoMapper.insertSelective(companyInfo);

        //商城
        if (3 == companyInfo.getType()) {

            //批量插入图片
            JSONArray imgArray = JSONArray.fromObject(registerDto.getImgList());
            List<CompanyImgauth> imgList = (List) JSONArray.toCollection(imgArray, CompanyImgauth.class);
            batchInsertImg(companyInfo.getCompanyInfoID(), companyInfo.getCompanyInfoID(), imgList);
            //增加对应店铺信息
            Long decID = companyDecorationService.insert(companyInfo);

            CompanyDecorationPage page = new CompanyDecorationPage();
            page.setDecorateID(decID);
            page.setUpdateUserId(registerDto.getCompanyInfo().getUserID() + "");
            page.setSectionSrcType(3);
            page.setSectionKey("showRoom");
            page.setSectionList(imgArray.toString());
            page.setLastUpdateDate(System.currentTimeMillis());
            page.setPageID(IdGen.get().nextId());
            companyDecorationPageMapper.insertSelective(page);


            //begin: 生成小商城首页模板数据 added by pengzh 2018-4-11
            Long newCompanyID = companyInfo.getCompanyInfoID();
            HotWord hotWord = hotWordMapper.findByCompanyLimit1(ProConstants.TEMP_CompanyID);
            if (null != hotWord && null != hotWord.getId()) {
                hotWord.setId(IdGen.get().nextId());
                hotWord.setCompanyID(newCompanyID);
                hotWordMapper.insert(hotWord);
            }
            //初始化一个专题
            Subject subject = subjectMapper.selectByCompanyLimit1(ProConstants.TEMP_CompanyID);
            if (null != subject && null != subject.getId()) {
                Long subjID = IdGen.get().nextId();
                subject.setId(subjID);
                subject.setCompanyID(newCompanyID);
                subject.setAddTime(System.currentTimeMillis());
                subjectMapper.insertSelective(subject);
            }

            Map<String, Object> para = new HashMap();
            para.put("companyID", ProConstants.TEMP_CompanyID);
            List<Homepage> homepageList = homepageMapper.selectAll(para);
            if (null != homepageList && homepageList.size() > 0) {
                Integer homepageId = homepageMapper.getMaxID();
                for (Homepage homepage : homepageList) {
                    homepage.setId(homepageId + 1);
                    homepage.setObejctList(null);
                    homepage.setTitle(null);
                    homepage.setSubtitle(null);
                    homepage.setObejctList(null);
                    homepage.setCompanyID(newCompanyID);

                    homepageId = homepage.getId();
                }
                homepageMapper.insertBatch(homepageList);
            }
            //end 生成小商城首页模板数据

        }


        //店长  代理负责人为店长
        if (null != companyInfo.getAdminID() && 3 == companyInfo.getType()) {
            /*UserInfo storeUser = userInfoService.selectByUserID(companyInfo.getAdminID());
            Organizational organizational = organizationalMapper.selectByPrimaryKey(companyInfo.getOrgID());

            if (1 == storeUser.getIsAdmin()) {
                if (organizational != null && organizational.getAdminID().equals(companyInfo.getAdminID())) {
                } else {
                    throw new ServiceException("该员工已经是店长", RestConst.ErrorCode.FORM_FAIL);
                }
            }*/
            UserInfo userInfo = new UserInfo();
            userInfo.setUserID(companyInfo.getAdminID());
            userInfo.setShopID(companyInfo.getCompanyInfoID());
            userInfo.setIsAdmin(1);
            userInfoService.updateByPrimaryKeySelective(userInfo);
        }


        return companyInfo.getCompanyInfoID();
    }


    //保存注册信息
    public Object updateShopInfo(SupplierRegisterDto registerDto) throws Exception {

        CompanyInfo companyInfo = new CompanyInfo();
        BeanUtils.copyProperties(companyInfo, registerDto.getCompanyInfo());
        Long timestamp = CommonUtils.getCurTimestamp();
        companyInfo.setUpdateTime(timestamp);


        //批量插入图片
        JSONArray imgArray = JSONArray.fromObject(registerDto.getImgList());
        if (null != imgArray && !imgArray.isEmpty()) {
            List<CompanyImgauth> imgList = (List) JSONArray.toCollection(imgArray, CompanyImgauth.class);
            batchInsertImg(companyInfo.getUserID(), companyInfo.getCompanyInfoID(), imgList);
        }
        companyInfoMapper.updateByPrimaryKeySelective(companyInfo);

        // //商城
        if (3 == companyInfo.getType()) {
            //增加对应店铺信息
            Long decID = companyDecorationService.update(companyInfo);
            //remove here by pengzh 18-7-31
//            if (null != imgArray && !imgArray.isEmpty()) {
//                List<CompanyDecorationPage> pageList = companyDecorationPageMapper.getListByDecorateID(decID);
//                if (null != pageList && !pageList.isEmpty()) {
//                    CompanyDecorationPage page = pageList.get(0);
//                    page.setSectionList(imgArray.toString());
//                    companyDecorationPageMapper.updateByPrimaryKeySelective(page);
//                }
//            }
        }
        //店长
        /*if (null != companyInfo.getAdminID() && 3 == companyInfo.getType()) {
            UserInfo storeUser = userInfoService.selectByUserID(companyInfo.getAdminID());
            if (1 == storeUser.getIsAdmin()) {
                throw new ServiceException("该员工已经是店长", RestConst.ErrorCode.FORM_FAIL);
            }
            UserInfo userInfo = new UserInfo();
            userInfo.setUserID(storeUser.getUserID());
            userInfo.setShopID(companyInfo.getCompanyInfoID());
            userInfo.setIsAdmin(1);
            userInfoService.updateByPrimaryKeySelective(userInfo);
        }*/
        return companyInfo.getCompanyInfoID();
    }

    //验证供应商名称
    public int verifySupplier(String companyName) {
        CompanyInfo companyInfo = companyInfoMapper.selectBycompanyName(companyName, SystemContext.getCompanyID());
        if (companyInfo == null) {
            return 1;
        } else {
            return 0;
        }
    }

    //修改供应商信息（审核失败才可修改，修改后变成未审核）
    public String updateCompanyInfo(CompanyInfoVo companyInfoVo) throws Exception {
        CompanyInfo companyInfo = new CompanyInfo();
        BeanUtils.copyProperties(companyInfo, companyInfoVo.getCompanyInfo());
        companyInfo.setUpdateTime(CommonUtils.getCurTimestamp());

        //修改供应商信息后需要重新审核
        if (companyInfo.getType() == 1) {
            companyInfo.setIsAudit(0);  //修改后变成未审核
        }
        CompanyInfo companyInfo1 = companyInfoMapper.selectByPrimaryKey(companyInfo.getCompanyInfoID());
        //批量插入图片
        JSONArray imgArray = JSONArray.fromObject(companyInfoVo.getImgauthList());
        List<CompanyImgauth> imgList = (List) JSONArray.toCollection(imgArray, CompanyImgauth.class);
        batchInsertImg(companyInfo.getUserID(), companyInfo.getCompanyInfoID(), imgList);
        companyInfoMapper.updateByPrimaryKeySelective(companyInfo);
        if (companyInfo1.getType() == 2) {
            companyDecorationService.update(companyInfo);

            //店铺修改后直接返回
            return "success";
        }
        if (!configService.isOpenErp()) {
            return "success";
        }
        try {
            int i = (int) erpInterfaceService.addOrUpdateCompanyForErp(companyInfo, 1);
            if (i != 1) {
                throw new ServiceException("修改供应商信息失败", RestConst.ErrorCode.FORM_FAIL);
            }
        } catch (Exception e) {
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("mobile", CommonTools.getExtString(restTemplate, ErpInterfaceCfgEnum.TELEPHONE.getCode())); //下单人手机
            jsonObject.put("type", SmsTempEnum.ERP_EXCEPTION.getCode());
            jsonObject.put("param", new String[]{"修改供应商对接ERP失败:组织ID为" + companyInfo.getCompanyInfoID()});
            DataResult resultSms = HttpUtil.httpPost(ProConstants.SMS + "/notice", jsonObject, restTemplate);
            if (resultSms.getIsSuccess() != 1) {
                logger.info("发送短信失败");
            }
            logger.info("修改供应商信息失败:" + companyInfo.getCompanyInfoID() + ":" + companyInfo.getCompanyName() + "--开始插入错误表信息");
            ErrErpBase errErpBase = errErpBaseMapper.selectByInfoId(companyInfo.getCompanyInfoID());
            if (errErpBase == null) {
                errErpBase = new ErrErpBase();
                errErpBase.setErrorId(IdGen.get().nextId());
                errErpBase.setInfoId(companyInfo.getCompanyInfoID());
                errErpBase.setAddTime(System.currentTimeMillis());
                errErpBase.setType("0");
                errErpBaseMapper.insertSelective(errErpBase);
            } else {
                errErpBase.setErrorId(IdGen.get().nextId());
                errErpBase.setInfoId(companyInfo.getCompanyInfoID());
                errErpBase.setAddTime(System.currentTimeMillis());
                errErpBase.setType("0");
                errErpBaseMapper.updateByPrimaryKeySelective(errErpBase);
            }
            logger.info("插入信息表成功");
        }
        return "success";
    }

    //供应商详情查询
    public CompanyInfoVo selectcompanyInfoByID(Long companyID) {
        CompanyInfoVo companyInfo = new CompanyInfoVo();
        companyInfo.setCompanyInfo(companyInfoMapper.selectByPrimaryKey(companyID));
        companyInfo.setImgauthList(companyImgauthMapper.selectByCompanyID(companyID));
        return companyInfo;
    }

    public CompanyInfo selectByPrimaryKey(Long companyID) {
        return companyInfoMapper.selectByPrimaryKey(companyID);
    }

    //供应商信息基本查询
    public CompanyInfo selectCompany(Long companyID) {
        return companyInfoMapper.selectByPrimaryKey(companyID);
    }

    //供应商银行账户addOrUpdate
    public String addOrUpdateAccount(CompanyBankaccount account) {
        if (account.getId() == null || account.getId() == 0) {
            account.setId(IdGen.get().nextId());
            companyBankaccountMapper.insert(account);
        } else {
            companyBankaccountMapper.updateByPrimaryKeySelective(account);
        }

        return "success";
    }

    //查询供应商银行账户
    public CompanyBankaccount selectAccountByCompanyID(Long companyID) {
        return companyBankaccountMapper.selectByCompanyID(companyID);
    }

    //按条件查询供应商列表信息
    public PageInfo selectListByCondition(int pageNum, int pageSize, CompanySelectDto selectDto) {
        selectDto.setCompanyID(SystemContext.getCompanyID());
        PageHelper.startPage(pageNum, pageSize);
        List<CompanyInfo> companyInfoList = companyInfoMapper.selectListByCondition(selectDto);
        PageInfo<CompanyInfo> page = new PageInfo(companyInfoList);
        return page;
    }

    //按条件查询供应商列表信息
    public List<Map<String,Object>> selectPullList(CompanySelectDto selectDto) {
        selectDto.setCompanyID(SystemContext.getCompanyID());
        List<Map<String,Object>> companyInfoList = companyInfoMapper.selectPullList(selectDto);
        return companyInfoList;
    }

    //按条件查询采购商列表信息
    public PageInfo selectPurchaseListByCondition(int pageNum, int pageSize, CompanySelectPurchaseDto selectDto) {
        selectDto.setCompanyID(SystemContext.getCompanyID());
        PageHelper.startPage(pageNum, pageSize);
        List<CompanyInfoDto> companyInfoList = companyInfoMapper.selectPurchaseListByCondition(selectDto);
        PageInfo<CompanyInfo> page = new PageInfo(companyInfoList);
        return page;
    }

    //供应商审核
    public String updateIsAudit(StateDto stateDto) {
        stateDto.setIsGold(null == stateDto.getIsGold() ? null : stateDto.getIsGold());
        int count = companyInfoMapper.updateIsAudit(stateDto);

        CompanyInfo companyInfo = companyInfoMapper.selectByPrimaryKey(stateDto.getuID());
        if (companyInfo == null) {
            throw new ServiceException("未找到供应商");
        }
        UserInfo userInfo = userInfoMapper.selectByPrimaryKey(companyInfo.getUserID());
        if (userInfo == null) {
            throw new ServiceException("未找到供应商登录信息");
        }
        userInfo.setIsStop(0);
        userInfoMapper.updateByPrimaryKeySelective(userInfo);
        if (stateDto.getState() == 1) {
            sendSuccessMsg(userInfo.getAccount()); //审核通过则发送短信
        }
        if (count == 1) {
            return "success";
        } else {
            return "修改失败";
        }
    }

    private void sendSuccessMsg(String moblie) {
        //审核通过则发送短信
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("mobile", moblie); //手机
        jsonObject.put("type", SmsTempEnum.USER_CHECK.getCode());
        jsonObject.put("param", new String[]{});

        DataResult result = HttpUtil.httpPost(ProConstants.SMS + "/notice", jsonObject, restTemplate);

        if (result.getIsSuccess() != 1) {
            logger.error("调用短信服务失败:" + result.getErrorDesc());
        } else {
            logger.info("发送账号审核通知短信ok.... " + moblie);
        }
    }


    public String updateSettleType(SettleTypeDto settleTypeDto) {
        int count = companyInfoMapper.updateSettleType(settleTypeDto);
        if (count == 1) {
            return "success";
        } else {
            return "修改失败";
        }
    }

    //供应商开启实时金价
    public String updateIsGold(StateDto stateDto) {
        int count = companyInfoMapper.updateIsGold(stateDto);

        if (count == 1) {
            return "success";
        } else {
            return "修改失败";
        }
    }


    //根据userID查询供应商信息
    public CompanyInfoVo selectByUserID(Long userID) {
        CompanyInfoVo companyInfoVo = new CompanyInfoVo();
        companyInfoVo.setCompanyInfo(companyInfoMapper.selectByUserID(userID));
        companyInfoVo.setImgauthList(companyImgauthMapper.selectByUserID(userID));
        return companyInfoVo;
    }

    public CompanyInfo selectByUserID2(Long userID) {
        return companyInfoMapper.selectByUserID(userID);
    }


    //按审核状态查询供应商数量
    public int selectCompanyQtyByIsAudit(Integer isAudit, Long companyID) {
        return companyInfoMapper.selectCompanyQtyByIsAudit(isAudit, companyID);
    }

    //批量插入图片
    public void batchInsertImg(Long userID, Long companyID, List<CompanyImgauth> imgList) {
        companyImgauthMapper.deleteByUserID(userID);
        Long timestamp = CommonUtils.getCurTimestamp();
        for (CompanyImgauth ci : imgList) {
            ci.setImgAuthID(IdGen.get().nextId());
            ci.setUserID(userID);
            ci.setCompanyID(companyID);
            ci.setCreateTime(timestamp);
        }
        if (imgList.size() > 0) {
            companyImgauthMapper.batchInsert(imgList);
        }
    }

    //根据联系人手机查询是否存在
    public Object selectSupplierByPhone(String contactPhone) {
        CompanyInfo companyInfo = companyInfoMapper.selectBycompanyContactPhone(contactPhone, SystemContext.getCompanyID());
        if (companyInfo == null) {
            return 1;
        } else {
            return 0;
        }
    }


    //根据联系人手机查询供应商信息
    public CompanyInfo selectSupplierInfoByPhone(String contactPhone) {
        CompanyInfo companyInfo = companyInfoMapper.selectBycompanyContactPhone(contactPhone, SystemContext.getCompanyID());
        return companyInfo;
    }

    public Object hasSettleType() {
        return companyInfoMapper.getHasSettleType(SystemContext.getCompanyID());
    }

    public String countByGroupID(Long groupID) {
        return companyInfoMapper.countByGroupID(groupID) + "";
    }


    public void qrcode(String content, HttpServletResponse response) {
        try {
            String c = new String(Base64Utils.decode(content), "utf-8");
            //logoUrl&content
            String[] a = c.split("&");
            if (ArrayUtils.isEmpty(a) || a.length < 2) {
                return;
            }
            String logoPath = a[0];
            String url = a[1];
            boolean needCompress = true;
            QRCodeUtil.renderFile(url, logoPath, needCompress, response);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


    //按条件查询分销商店铺列表信息
    public PageInfo selectShopListByCondition(int pageNum, int pageSize, CompanySelectPurchaseDto selectDto) {
        //selectDto.setCompanyID(SystemContext.getCompanyID());
        PageHelper.startPage(pageNum, pageSize);
        List<CompanyInfoDto> companyInfoList = companyInfoMapper.selectShopListByCondition(selectDto);
        PageInfo<CompanyInfo> page = new PageInfo(companyInfoList);
        return page;
    }
}
